layui.use(['form', 'fsoft'], function () {
	var $ = layui.$
		, form = layui.form
		, fsoft = layui.fsoft;
	var id = $('#id').val();
	form.verify({
		loginPwdConfirm: function (value, item) {
			var loginPwd = $('input[name="loginPwd"]').val();
			if (loginPwd != value)
				return "两次密码不一致";
		}
	});
	// 监听提交
	form.on('submit(save)', function (data) {
		var formData = data.field;
		var loginPwd = formData.loginPwd;
		var base = new Base64();
		loginPwd = base.encode(loginPwd);
		formData["loginPwd"] = loginPwd;
		fsoft.post(layui.cache['contentPath'] + '/sys-user/modifyPwd', formData, function (rs) {
			if (rs.code == 0) {
				fsoft.successMsg("密码修改成功！");
				xadmin.close();
			} else {
				fsoft.errorMsg(rs.msg);
			}
		});
		return false;
	});
});